<template>
	<u-modal v-model="show" :content="content" :title="$t('权限说明')" :confirm-text="$t('知晓')" @confirm="confirm"
		:show-cancel-button="true" :cancel-text="$t('拒绝')" @cancel="cancel">
		<view class="permission">
			<view style="text-align: center;font-weight: 600;">{{$t('该功能将获取以下权限')}}</view>
			<view>1.{{$t("读取相册权限：以便您能够选择并上传图片或视频到我们的应用中")}}。</view>
			<view>2.{{$t("摄像头权限：以便您能够选择并上传图片或视频到我们的应用中")}}。</view>
			<view>3.{{$t("文件权限：以便您能够选择并上传文件到我们的应用中")}}。</view>
		</view>
	</u-modal>
</template>

<script>
	export default {
		name: "Permission",
		props: {
			value: {
				type: Boolean,
				default: true,
			},
			content: {
				type: [String, null],
				default: "",
			},
		},
		data() {
			return {
				show: false,
			};
		},
		created() {

		},
		mounted() {
			console.log(uni.getStorageSync("permission"))
			this.$u.api.user.appCheck().then(res => {
				//if (!uni.getStorageSync("permission") && res.report) {
				if (res.report) {
					this.show = true;
				}
			})
		},
		methods: {
			cancel() {
				uni.navigateBack();
			},
			confirm() {
				this.show = false;
				uni.setStorageSync("permission", 1)
				// this.$emit("input", false)
			}
		},
	}
</script>

<style lang="scss" scoped>
	.permission {
		&>view {
			padding: 0 20rpx;
			line-height: 50rpx;
			text-indent: 24rpx;
			margin-top: 30rpx;
		}
	}
</style>